<?php
// +-------------------------------------------------------------------
// |
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Service\Api\V1;

class GetSessionKey
{
    public $login = true; //是否需要登录才能访问该接口
    public $title = "获取小程序登录信息";
    public $group = '用户';
    public $desc = "";

    public $input = [
        'code' => 'label=code;',
    ];

    public $output = [
    ];

    public function run($param, $uid)
    {
       $where = array(
            'type' => 'weixin',
            'status' => 1
        );
        $payConfig = M('OauthSettings')->where($where)->find();
        if (!$payConfig) {
            throw new \Exception('无效的微信配置');
        }
        $payConfig['config'] = json_decode(kcone_think_decrypt($payConfig['config']), true);
        return $payConfig;

    }
}
